from common.base import Base, get_driver
import time
from selenium.webdriver.common.by import By


class Product1Page(Base):
    product_url = 'http://localhost:8080/ecshop/goods.php?id=32'

    # 点击商品的立即购买，加入购物车
    def click_add(self):
        self.click((By.XPATH, '//a[@href="javascript:addToCart(72)"]/img'))


if __name__ == '__main__':
    driver = get_driver()
    driver.get('http://localhost:8080/ecshop/goods.php?id=72')
    p = Product1Page(driver)
    p.click_add()